import os
import re
import datetime

class Config:
    root_path = os.path.dirname(os.path.dirname(os.path.realpath(__file__)))
    # 日志路径
    log_dir = root_path+'/ServerLogs/'

    # mysql连接
    host = 's5592i.db.dpool.sina.com.cn'
    port = 5592
    database = 'search'
    charset = 'utf8'
    user = 'search'
    password = "1wSeH45tGc"

    # redis连接
    redis_host = '127.0.0.1'
    redis_port = 6727
    decode_responses = True
    redis_extime = 604800


    LTP_DIR = root_path+'/model/'

    # faiss参数
    dim = 64
    nlist = 128
    metric = 'INNER_PRODUCT'
    nprobe = 10
    historydir = root_path + '/data/history'
    history = historydir+'/history.csv'
    index = historydir+'/historyindex'


    # dssm模型提取向量
    vecurl = "http://10.39.66.167:11726/title2vec/"

    # simbert
    #SimBertPath = root_path + '/model/simbert/'

    # 停用词路径
    stopword_path = root_path+'/data/'

    # 疫情re
    COVID_LIST = ['[新增](.+?)(\d)+[例]',
                  '[新增](.*?)[例]',
                  '[新增](.+?)[无症状]',
                  '[累计](.+?)[例|万]',
                  '[死亡](.+?)[例]',
                  '[治愈](.+?)[例|万]',
                  '[出院](.+?)[例|万]',
                  '[阳性](.*?)[例]',
                  '(\d)+[新增]',
                  '新增确诊',
                  '确诊病例',
                  '疫情',
                  '疫苗',
                  '新冠疫苗',
                  '低风险',
                  '中风险',
                  '无症状感染者',
                  '高风险',
                  '中高风险',
                  '中低风险',
                  '[核酸](.*?)[证明]',
                  '[核酸](.*?)[检测]',
                  '[核酸](.*?)[阳性]',
                  '[核酸](.*?)[排查]',
                  '[检测](.*?)[核酸]'
                  ]
    COVID_RE = re.compile('|'.join(item for item in COVID_LIST))

    def __init__(self, **kwargs):
        for k, v in kwargs.items():
            setattr(self, k, v)

